#include <iostream>
#include <string>

#include "include/searcher.h"

using namespace std;

int main(int argc, char** argv) {
  Searcher* searcher = new Searcher();
  
  const int show_num = 10;
  
  SRes* result = new SRes[show_num];

  string query;
  int total_num;

  while (cin >> query) {
    int total_num = searcher->search(query,show_num,result);
    cout << "total_num: " << total_num << endl;

    int actual_show_num = min(total_num, show_num);

    for(int i = 0; i < actual_show_num; ++i)
      cout<<"id: "<<result[i].id
          <<"\tscore: "<<result[i].score
	  <<"\ttitle: "<<result[i].title
          <<"\turl: "<<result[i].url
          <<endl;
  }

  delete []result;
  delete searcher;

  return 0;
}
